﻿@using SCMS.Resources
@model SCMS.UI.Models.ORequest
@{AjaxOptions ajaxOpts = new AjaxOptions
      {
          UpdateTargetId = "requestDiv",
          LoadingElementId = "loading",
          HttpMethod = "Post",
          Url = Url.Action("UpdateOrderRequest"),
          OnSuccess = "CloseDialog"
      };}

<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>@Resources_frank.OrderRequest_AddPPItems2OR_EditOR:: @Model.EntityOrderRequest.RefNumber</h3>
    </div>
    <br />
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
    {
        @Html.ValidationSummary(true)
            
        <table width="98%" align="center" cellpadding="0">
            <tr>
                <th align="center" width="34%">
                    @Resources_frank.Global_String_RefNo
                </th>
                <th align="center" width="33%">
                    @Resources_frank.Global_String_Date
                </th>
                <th align="center" width="33%">
                    @Resources_frank.Global_String_ORCurrency
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.TextBoxFor(m => m.OrderRequestNo, new { @readonly = "readonly" })
                    @Html.HiddenFor(m => m.EntityOrderRequest.Id)
                </td>
                <td align="center">
                    @Html.EditorFor(m => m.IssueDate)
                    @Html.ValidationMessageFor(m => m.IssueDate)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.CurrencyID, Model.currencies, Resources_frank.Global_String_PleaseSelect, new { @id = "currencyId" })
                    @Html.ValidationMessageFor(x => x.CurrencyID)
                </td>
            </tr>
            <tr>
                <th align="center">
                    @Resources_frank.Global_String_ProjectProgramme
                </th>
                <th align="center">
                    @Resources_frank.Budget_CategoryList_ProjectNo
                </th>
                <th align="center">
                    @Resources_frank.Budget_CategoryList_Donor
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.DropDownListFor(x => x.ProjectId, Model.Projects, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProject", onchange = "javascript:selectedIndexChangePONos(this)" })
                    @Html.ValidationMessageFor(x => x.ProjectId)
                </td>
                <td align="center">
                    <div id="ProjectNoDiv">
                        @Html.DropDownListFor(x => x.ProjectDonorId, Model.ProjectNos, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProNo", onchange = "javascript:selectedIndexChange(this)" })
                        @Html.ValidationMessageFor(x => x.ProjectDonorId)</div>
                </td>
                <td align="center">
                    <div id="donorDiv" style="font-size: 12px;">
                        @ViewBag.Donor
                    </div>
                </td>
            </tr>
            <tr>
                <th align="center">
                    @Resources_frank.OrderRequest_EditOrderRequest_RequestedDeliveryDate
                </th>
                <th align="center">
                    @Resources_frank.OrderRequest_EditOrderRequest_RequestedDeliveryDestination
                </th>
                <th align="center">
                    @Resources_frank.OrderRequest_EditOrderRequest_FinalDeliveryDestination
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.EditorFor(m => m.RequestDate)
                    @Html.ValidationMessageFor(m => m.RequestDate)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.RequestDelivLocationID, Model.RequestDelivLocations, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.RequestDelivLocationID)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.FinalDelivLocationID, Model.FinalDelivLocations, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.FinalDelivLocationID)
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" id="orbutton" class="btn green" value="@Resources_frank.Global_String_SaveChanges" />
                </td>
            </tr>
        </table>    
    }
</div>
